fix: handle invalid schema data - #106
Conversation
lott-ai
commented
Jul 11, 2020
- fixes https://github.com/stoplightio/platform-internal/issues/3501
|
🎉 This PR is included in version 3.1.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
There was a problem hiding this comment.
Hmm, I saw this merged but I got a review request so just posting this for the posterity.
This is very wrong to me. The Schema type is already implying that data is an object and not undefined.
If this line is required it means somebody calling this function is lying/casting. That's not this function's problem; it should not be the its job of this function to validate the passed value; otherwise why do we have the types for?
You can see this effectively by the fact that you had to "lie" in the test by doing a ts-ignore.
I'd vote to fix this where the real problem is and not here @lottamus @marbemac
|
@XVincentX yeah since we are transforming user input, we cannot assume the |
I would not rely on this for the following reasons:
I wouldn't want to throw an exception either, but we could use the That said — I understand now the issue and I've created a ticket to tame this although to be honest, I do not think we're going to have the time to make this right, but you never know. |
True, but
The reasoning I was trying to make was that it's not
Exactly, thus |
Completely agree with this. That's way I was pointing out that Spectral is not enough. I must have misunderstood your comment.
I agree with this also, but if so this specific is going on a different direction, right? ( Seems like we're on the same page. |